#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>
#include <QThread>
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    connect(this, &MainWindow::event, this, &MainWindow::on_event);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_event(QByteArray &bytes)
{
    QThread::sleep(10);
    qDebug()<<__func__<<":"<<bytes<<" address="<<&bytes;
}

void MainWindow::on_pushButton_clicked()
{
    QByteArray test;
    qDebug()<<__func__<<":"<<test<<" address="<<&test;
    test = "Hello world";
    emit event(test);
    qDebug()<<__func__<<":"<<test<<" address="<<&test;
    test.clear();
}
